]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
St: require libcroco >= 0.6.2
authorDan Winship <danw@gnome.org>
Mon, 4 Apr 2011 18:02:19 +0000 (14:02 -0400)
committerDan Winship <danw@gnome.org>
Wed, 27 Apr 2011 19:29:24 +0000 (15:29 -0400)
and remove the workaround for the parsing bug in earlier versions

https://bugzilla.gnome.org/show_bug.cgi?id=648760

configure.ac
src/st/st-theme-node.c
src/st/st-theme.c

index 7f82cccb6b045350c71e596ac0673665e5ebaaa6..8449f0712e5ee2c1eaa025e47a878a2aacb9bb79 100644 (file)
@@ -116,7 +116,7 @@ AC_CHECK_FUNCS(JS_NewGlobalObject sn_startup_sequence_get_application_id XFixesC
 CFLAGS=$saved_CFLAGS
 LIBS=$saved_LIBS
 
-PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-3.0 libcroco-0.6 gnome-desktop-3.0 >= 2.90.0 x11)
+PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-3.0 libcroco-0.6 >= 0.6.2 gnome-desktop-3.0 >= 2.90.0 x11)
 PKG_CHECK_MODULES(GDMUSER, dbus-glib-1 gtk+-3.0)
 PKG_CHECK_MODULES(TRAY, gtk+-3.0)
 PKG_CHECK_MODULES(GVC, libpulse libpulse-mainloop-glib gobject-2.0)
index 7adfd1342853a3cd1cc2f3c53a64ff0f8a834b12..1c2856b8fe4667732c140da97edafc04d4cbb015 100644 (file)
@@ -483,21 +483,12 @@ get_color_from_term (StThemeNode  *node,
   /* rgba () colors - a CSS3 addition, are not supported by libcroco,
    * but they are parsed as a "function", so we can emulate the
    * functionality.
-   *
-   * libcroco < 0.6.2 has a bug where functions starting with 'r' are
-   * misparsed. We workaround this by pre-converting 'rgba' to 'RGBA'
-   * before parsing the stylesheet. Since libcroco isn't
-   * case-insensitive (a bug), it's fine with functions starting with
-   * 'R'. (In theory, we should be doing a case-insensitive compare
-   * everywhere, not just here, but that doesn't make much sense when
-   * the built-in parsing of libcroco is case-sensitive and things
-   * like 10PX don't work.)
    */
   else if (term->type == TERM_FUNCTION &&
            term->content.str &&
            term->content.str->stryng &&
            term->content.str->stryng->str &&
-           g_ascii_strcasecmp (term->content.str->stryng->str, "rgba") == 0)
+           strcmp (term->content.str->stryng->str, "rgba") == 0)
     {
       return get_color_from_rgba_term (term, color);
     }
index bce53b429bf0c2541410cef239edf65c23f95565..326d9def937d02541871d0aa3b7aaf65c37ab794 100644 (file)
@@ -155,90 +155,6 @@ st_theme_class_init (StThemeClass *klass)
 
 }
 
-/* This is a workaround for a bug in libcroco < 0.6.2 where
- * function starting with 'r' (and 'u') are misparsed. We work
- * around this by exploiting the fact that libcroco is incomformant
- * with the CSS-spec and case sensitive and pre-convert all
- * occurrences of rgba to RGBA. Then we make our own parsing
- * code check for RGBA as well.
- */
-#if LIBCROCO_VERSION_NUMBER < 602
-static gboolean
-is_identifier_character (char c)
-{
-  /* Actual CSS rules allow for unicode > 0x00a1 and escaped
-   * characters, but we'll assume we won't do that in our stylesheets
-   * or at least not next to the string 'rgba'.
-   */
-  return g_ascii_isalnum(c) || c == '-' || c == '_';
-}
-
-static void
-convert_rgba_RGBA (char *buf)
-{
-  char *p;
-
-  p = strstr (buf, "rgba");
-  while (p)
-    {
-      /* Check if this looks like a complete token; this is to
-       * avoiding mangling, say, a selector '.rgba-entry' */
-      if (!((p > buf && is_identifier_character (*(p - 1))) ||
-            (is_identifier_character (*(p + 4)))))
-        memcpy(p, "RGBA", 4);
-      p += 4;
-      p = strstr (p, "rgba");
-    }
-}
-
-static CRStyleSheet *
-parse_stylesheet (const char  *filename,
-                  GError     **error)
-{
-  enum CRStatus status;
-  char *contents;
-  gsize length;
-  CRStyleSheet *stylesheet = NULL;
-
-  if (filename == NULL)
-    return NULL;
-
-  if (!g_file_get_contents (filename, &contents, &length, error))
-    return NULL;
-
-  convert_rgba_RGBA (contents);
-
-  status = cr_om_parser_simply_parse_buf ((const guchar *) contents,
-                                          length,
-                                          CR_UTF_8,
-                                          &stylesheet);
-  g_free (contents);
-
-  if (status != CR_OK)
-    {
-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
-                   "Error parsing stylesheet '%s'; errcode:%d", filename, status);
-      return NULL;
-    }
-
-  return stylesheet;
-}
-
-CRDeclaration *
-_st_theme_parse_declaration_list (const char *str)
-{
-  char *copy = g_strdup (str);
-  CRDeclaration *result;
-
-  convert_rgba_RGBA (copy);
-
-  result = cr_declaration_parse_list_from_buf ((const guchar *)copy,
-                                               CR_UTF_8);
-  g_free (copy);
-
-  return result;
-}
-#else /* LIBCROCO_VERSION_NUMBER >= 602 */
 static CRStyleSheet *
 parse_stylesheet (const char  *filename,
                   GError     **error)
@@ -269,7 +185,6 @@ _st_theme_parse_declaration_list (const char *str)
   return cr_declaration_parse_list_from_buf ((const guchar *)str,
                                              CR_UTF_8);
 }
-#endif /* LIBCROCO_VERSION_NUMBER < 602 */
 
 /* Just g_warning for now until we have something nicer to do */
 static CRStyleSheet *